//
// Created by f12160c on 2018/7/26.
//

#include <iostream>
#include <vector>
#include<gtest/gtest.h>

#include "leetcode/leetcode.hpp"

using namespace std;

namespace {
    TEST(test_findSubstring, 1) {
        string s = "barfoothefoobarman";
        vector<string> words = {"foo","bar"};
        vector<int> expect = {0,9};
        auto actual = Solution::findSubstring_1(s, words);

        ASSERT_EQ(expect, actual);
    }

    TEST(test_findSubstring, 2) {
        string s = "wordgoodstudentgoodword";
        vector<string> words = {"word","student"};
        vector<int> expect = {};
        auto actual = Solution::findSubstring(s, words);

        ASSERT_EQ(expect, actual);
    }

    TEST(test_findSubstring, 3) {
        string s = "";
        vector<string> words = {"a"};
        vector<int> expect = {};
        auto actual = Solution::findSubstring(s, words);

        ASSERT_EQ(expect, actual);
    }

    TEST(test_findSubstring, 4) {
        string s = "barfoofoobarthefoobarman";
        vector<string> words = {"bar","foo","the"};
        vector<int> expect = {6, 9, 12};
        auto actual = Solution::findSubstring(s, words);

        ASSERT_EQ(expect, actual);
    }

    TEST(test_findSubstring, 5) {
        string s = "wordgoodgoodgoodbestword";
        vector<string> words = {"word","good","best","good"};
        vector<int> expect = {8};
        auto actual = Solution::findSubstring(s, words);

        ASSERT_EQ(expect, actual);
    }

}